<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的陪玩信息</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/CSS/accompany/accompany.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/CSS/accompany/my-accompany.css">


</head>

<script>
    const BASE_URL = "${pageContext.request.contextPath}";
    const userName2="${user2.userName}";
    const userId2=${user2.userId};
    const email2='${user2.email}';
</script>

<body>
<div class="container">
    <header>
        <div class="logo">
            <i class="fas fa-gamepad"></i>
            <span>我的陪玩服务</span>
        </div>

        <div class="tagline">管理您提供的陪玩服务</div>
        <a href="${pageContext.request.contextPath}/accompany?email=${user2.email}" class="btn btn-outline">
            <i class="fas fa-arrow-left"></i> 返回首页
        </a>
    </header>

    <!-- 我的陪玩列表 -->
    <section class="my-services-section">
        <h2 class="section-title"><i class="fas fa-list"></i> 我的陪玩服务</h2>

        <div class="info-card" id="no-services-message" style="display: none;">
            <i class="fas fa-info-circle"></i>
            <p>您还没有发布任何陪玩服务</p>
            <a href="${pageContext.request.contextPath}/accompany.jsp#add-service-modal" class="btn btn-primary">
                <i class="fas fa-plus"></i> 创建第一个服务
            </a>
        </div>

        <div class="my-services-grid" id="my-services-container">
            <!-- 服务卡片将通过JavaScript动态生成 -->
        </div>
    </section>
</div>

<!-- 编辑服务模态框 -->
<div class="modal" id="edit-service-modal">
    <div class="modal-content">
        <span class="close-modal" id="close-edit-modal">&times;</span>
        <h2 class="modal-title">编辑陪玩服务</h2>

        <form id="edit-service-form">
            <input type="hidden" id="edit-id">

            <div class="form-group">
                <label for="edit-game-type">游戏类型</label>
                <select id="edit-game-type" required>
                    <option value="">请选择游戏</option>
                    <option value="王者荣耀">王者荣耀</option>
                    <option value="和平精英">和平精英</option>
                    <option value="LOL">LOL</option>
                    <option value="原神">原神</option>
                    <option value="DOTA2">DOTA2</option>
                    <option value="CSGO">CSGO</option>
                </select>
            </div>

            <div class="form-group">
                <label for="edit-service-type">陪玩类型</label>
                <select id="edit-service-type" required>
                    <option value="">请选择类型</option>
                    <option value="上分">上分陪玩</option>
                    <option value="教学">教学陪玩</option>
                    <option value="娱乐">娱乐陪玩</option>
                    <option value="代练">代练服务</option>
                </select>
            </div>

            <div class="form-group">
                <label for="edit-description">服务描述</label>
                <textarea id="edit-description" rows="4" required placeholder="详细描述您的服务内容..."></textarea>
            </div>

            <div class="form-group">
                <label for="edit-price">价格 (元/小时)</label>
                <input type="number" id="edit-price" min="0" step="0.01" required placeholder="例如：68.00">
            </div>

            <div class="form-group">
                <label for="edit-contact">联系方式</label>
                <input type="text" id="edit-contact" required placeholder="游戏ID或联系方式">
            </div>

            <!-- 当前图片预览 -->
            <div class="form-group">
                <label>当前图片</label>
                <div class="file-preview" id="edit-image-preview"></div>
            </div>

            <!-- 当前语音介绍 -->
            <div class="form-group">
                <label>当前语音介绍</label>
                <div class="voice-player" id="current-voice-player">
                    <div class="play-btn" id="current-play-btn">
                        <i class="fas fa-play"></i>
                    </div>
                    <div class="voice-info">
                        <div>语音介绍</div>
                        <p>点击播放按钮</p>
                    </div>
                </div>
            </div>

            <!-- 重新上传音频 -->
            <div class="form-group">
                <label for="edit-audio">重新上传语音介绍</label>
                <div class="file-upload">
                    <input type="file" id="edit-audio" accept="audio/*">
                    <div class="file-preview" id="edit-audio-preview"></div>
                </div>
            </div>

            <div class="form-actions">
                <button type="submit" class="btn btn-primary">
                    <i class="fas fa-save"></i> 保存修改
                </button>
                <button type="button" id="cancel-edit" class="btn btn-outline">
                    <i class="fas fa-times"></i> 取消
                </button>
            </div>
        </form>
    </div>
</div>

<script src="${pageContext.request.contextPath}/static/JS/accompany/my-accompany.js"></script>
</body>
</html>